<?php
$testUrl='https://nc-api-test.51wom.com/api/customerUserMountainClimbing/register';



function http_post_json($url, $jsonStr)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: ' . strlen($jsonStr)
        )
    );
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
 
    return array($httpCode, $response);
}

$phone='13683234556';
$name='小张起';
$sourcetype='695';
$regsubchannel='695';
$code='123456';
$babybirth='2015-05-28';
$secbabybirth='';
$sourceId='ac011'; 

//使用方法
$post_data = array(
  'phone' => $phone,
  'name' => $name,
  'sourcetype' => $sourcetype,
  'regsubchannel' => $regsubchannel,
  'code' => $code,
  'babybirth' => $babybirth,
  'sourceId' => $sourceId
);
$getData=http_post_json($testUrl, json_encode($post_data,JSON_UNESCAPED_UNICODE));


echo $testUrl;
echo "<br /><br />";
echo json_encode($post_data,JSON_UNESCAPED_UNICODE);

echo "<br /><br />";

var_dump($getData);


 